﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using Xiucai.Common.Data;
using Xiucai.BPM.Core.Dal;

namespace Xiucai.BPM.Core.Model
{
    [TableName("Dev_Dev")]
    [Description("设备管理")]
    public class DevConfig
    {
        [DefaultValue(0)]
        public int KeyId { get; set; }

        [Description("设备类型")]
        public string DevType { get; set; }

        [Description("设备ID")]
        public int DevID { get; set; }

        [Description("设备经纬度")]
        public string DevLocation { get; set; }

        [Description("设备所有人")]
        public string DevOwnerName { get; set; }

        [Description("设备所有人ID")]
        public int DevOwnerID{ get; set; }

        [Description("设备备注、或者联系方式等等")]
        public string DevContact { get; set; }
        [Description("小气候")]
        public string XQHID { get; set; }

        [Description("通道1")]
        public string chn0 { get; set; }
        [Description("通道2")]
        public string chn1 { get; set; }
        [Description("通道3")]
        public string chn2 { get; set; }
        [Description("通道4")]
        public string chn3 { get; set; }

        [Description("精度")]
        public decimal  mjd { get; set; }
        [Description("纬度")]
        public decimal  mwd { get; set; }
        [Description("建立时间")]
        public string mdatetime { get; set; }
        [Description("备注")]
        public string mmark { get; set; }
        [Description("图片地址")]
        public string mpic { get; set; }
        [Description("图片")]
        public string changedatetime { get; set; }

        [DbField(false)]
        public string chs
        {
            get { return chn0 + "," + chn1 + "," + chn2 + "," + chn3; }
        }
        [DbField(false)]
        public string onlinedayscbd
        {
            get {
                return DevStatusDal.Instance.GetCBDDay(DevID.ToString()).ToString(); 
            }
        }
        [DbField(false)]
        public string onlinedaysybq
        {
            get
            {
                return DevStatusDal.Instance.GetYBQDay(DevID.ToString()).ToString();
            }
        }
        [DbField(false)]
        public string onlinedaysxqh
        {
            get
            {
                return DevStatusDal.Instance.GetXQHDay(DevContact).ToString();
            }
        }
    }
}
